#
#Makefile
#

#CROSS_COMPILE := i686-w64-mingw32-

LIBNAME := cobject

SRC := $(wildcard *.c)
OBJ := $(SRC:.c=.o)
BIN := $(LIBNAME)-test

CFLAGS += -D_GNU_SOURCE
CFLAGS += -pipe -Wall
CFLAGS += -I../

LDFLAGS += -L../build/x86_linux
LDFLAGS += -l$(LIBNAME)
LDFLAGS += "-Wl,-rpath=../build/x86_linux"

CC := $(CROSS_COMPILE)gcc
RM := rm -f

.PHONY:def print clean distclean all

def: print $(BIN)

print:
	@echo "CC = $(CC)"
	
$(OBJ):%.o:%.c
	@echo "CC $@"
	@$(CC) $(CFLAGS) -c $< -o $@
	
$(BIN):$(OBJ)
	@echo "LD $@"
	@$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)

clean:
	@echo "RM *.o"
	@$(RM) *.o

distclean:clean
	@echo "RM $(BIN)"
	@$(RM) -r $(BIN) 

all:def clean
	
